package com.ss.android.article.lite.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;

import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.feature.shrink.extend.ArticleBaseExtendManager;
import com.ss.android.article.base.feature.splash.BaseSplashActivity;
import com.ss.android.common.util.ImmersedStatusBarHelper.ImmersedStatusBarConfig;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

public class SplashActivity extends BaseSplashActivity {
    static boolean c = false;
    private Intent n = null;
    private CountDownLatch o = new CountDownLatch(1);

    public final Intent c() {
        Intent v0;
        if (this.n != null) {
            v0 = this.n;
        } else {
            v0 = new Intent(((Context) this), MainActivity.class);
            v0.addFlags(32768);
            if (Build.VERSION.SDK_INT >= 21) {
                v0.addFlags(67108864);
                v0.addFlags(536870912);
            }
        }

        return v0;
    }

    public final boolean f() {
        try {
            if (this.o.await(100, TimeUnit.MILLISECONDS)) {
//                goto label_6;
            } else {
                this.j();
            }
        } catch (InterruptedException v0) {
            v0.printStackTrace();
        }

//    label_6:
        return this.n != null || (super.f());
    }

    public ImmersedStatusBarConfig getImmersedStatusBarConfig() {
        ImmersedStatusBarConfig v0 = new ImmersedStatusBarConfig().setStatusBarColor(com.ss.android.article.browser.R.color.transparent);
        v0.mIsUseLightStatusBar = false;
        v0.f = false;
        v0.mFitsSystemWindows = false;
        return v0;
    }

    final void j() {
        try {
            if (!SplashActivity.c && (ArticleBaseExtendManager.getInstance().loadUgrReadApkAdapter2(((Context) this)))) {
                this.n = ArticleBaseExtendManager.getInstance().loadUgrReadApkAdapter(((Context) this));
            }
        } catch (Throwable v0) {
            this.o.countDown();
            throw v0;
        }
        this.o.countDown();
    }

    public void onCreate(Bundle savedInstanceState) {
        if (!this.isTaskRoot()) {
            this.finish();
        }

        com.bytedance.ttstat.a.i(this);
        com.ss.android.l.c.c();
        if (AppData.isInitialized()) {
            AppData.getInstance().O();
            AppData.getInstance().bu.clear();
        }

        new com.ss.android.article.lite.activity.a(this, "Splash-AsyncInit").start();
        com.ss.android.l.c.c();
        super.onCreate(savedInstanceState);
        com.ss.android.l.c.c();
        com.bytedance.ttstat.a.j(this);
    }

    public void onResume() {
        com.bytedance.ttstat.a.k(((Activity) this));
        super.onResume();
        com.bytedance.ttstat.a.l(((Activity) this));
    }

    public void onStop() {
        super.onStop();
        com.bytedance.ttstat.a.d(((Activity) this));
    }
}

